home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / tcp / samba_2.0.7.lha / source / amiga / Assert.h < prev    next >
C/C++ Source or Header  |  2000-12-25  |  4KB  |  100 lines

  1. /*
  2.  * $Id: Assert.h 1.8 2000/12/25 11:49:10 olsen Exp olsen $
  3.  *
  4.  * :ts=8
  5.  *
  6.  * AmigaOS wrapper routines for Samba 2.0.0, using the AmiTCP V3 API
  7.  * and the SAS/C V6.58 compiler.
  8.  *
  9.  * Copyright (C) 1999-2000 by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  * 
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  * 
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25.  
  26. /****************************************************************************/
  27.  
  28. /* IMPORTANT: If DEBUG is redefined, it must happen only here. This
  29.  *            will cause all modules to depend upon it to be rebuilt
  30.  *            by the smakefile (that is, provided the smakefile has
  31.  *            all the necessary dependency lines in place).
  32.  */
  33.  
  34. /*#define DEBUG*/
  35.  
  36. /****************************************************************************/
  37.  
  38. #ifdef ASSERT
  39. #undef ASSERT
  40. #endif    /* ASSERT */
  41.  
  42. #define PUSH_ASSERTS()    PUSHDEBUGLEVEL(0)
  43. #define PUSH_REPORTS()    PUSHDEBUGLEVEL(1)
  44. #define PUSH_CALLS()    PUSHDEBUGLEVEL(2)
  45. #define PUSH_ALL()    PUSHDEBUGLEVEL(2)
  46. #define POP()        POPDEBUGLEVEL()
  47.  
  48. #if defined(DEBUG) && defined(__SASC)
  49.  void _ASSERT(int x,const char *xs,const char *file,int line,const char *function);
  50.  void _SHOWVALUE(unsigned long value,int size,const char *name,const char *file,int line);
  51.  void _SHOWSTRING(const char *string,const char *name,const char *file,int line);
  52.  void _SHOWMSG(const char *msg,const char *file,int line);
  53.  void _ENTER(const char *file,int line,const char *function);
  54.  void _LEAVE(const char *file,int line,const char *function);
  55.  void _RETURN(const char *file,int line,const char *function,unsigned long result);
  56.  void _DPRINTF_HEADER(const char *file,int line);
  57.  void _DPRINTF(const char *format,...);
  58.  int  _SETDEBUGLEVEL(int level);
  59.  void _PUSHDEBUGLEVEL(int level);
  60.  void _POPDEBUGLEVEL(void);
  61.  void _SETPROGRAMNAME(char *name);
  62.  
  63.  #define ASSERT(x)        _ASSERT((int)(x),#x,__FILE__,__LINE__,__FUNC__)
  64.  #define ENTER()        _ENTER(__FILE__,__LINE__,__FUNC__)
  65.  #define LEAVE()        _LEAVE(__FILE__,__LINE__,__FUNC__)
  66.  #define RETURN(r)        _RETURN(__FILE__,__LINE__,__FUNC__,(unsigned long)r)
  67.  #define SHOWVALUE(v)        _SHOWVALUE((unsigned long)(v),sizeof(v),#v,__FILE__,__LINE__)
  68.  #define SHOWSTRING(s)        _SHOWSTRING((const char *)(s),#s,__FILE__,__LINE__)
  69.  #define SHOWMSG(s)        _SHOWMSG((const char *)(s),__FILE__,__LINE__)
  70.  #define D(s)            do { _DPRINTF_HEADER(__FILE__,__LINE__); _DPRINTF s; } while(0)
  71.  #define SETDEBUGLEVEL(l)    _SETDEBUGLEVEL(l)
  72.  #define PUSHDEBUGLEVEL(l)    _PUSHDEBUGLEVEL(l)
  73.  #define POPDEBUGLEVEL()    _POPDEBUGLEVEL()
  74.  #define SETPROGRAMNAME(n)    _SETPROGRAMNAME(n)
  75.  
  76.  #undef DEBUG
  77.  #define DEBUG 1
  78. #else
  79.  #define ASSERT(x)        ((void)0)
  80.  #define ENTER()        ((void)0)
  81.  #define LEAVE()        ((void)0)
  82.  #define RETURN(r)        ((void)0)
  83.  #define SHOWVALUE(v)        ((void)0)
  84.  #define SHOWSTRING(s)        ((void)0)
  85.  #define SHOWMSG(s)        ((void)0)
  86.  #define D(s)            ((void)0)
  87.  #define SETDEBUGLEVEL(l)    ((void)0)
  88.  #define PUSHDEBUGLEVEL(l)    ((void)0)
  89.  #define POPDEBUGLEVEL()    ((void)0)
  90.  #define SETPROGRAMNAME(n)    ((void)0)
  91.  
  92.  #ifdef DEBUG
  93.  #undef DEBUG
  94.  #endif /* DEBUG */
  95.  
  96.  #define DEBUG 0
  97. #endif /* DEBUG */
  98.  
  99. /****************************************************************************/
  100.